Repository navigation
fix(console): a refused Set as default restores the previous default app - #38027
Conversation
Demote-first stays (never two defaults); each demotion that landed is now put back in its own package scope when the promote is refused, and a refused restore gets its own error toast. Claude-Session: https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg Co-authored-by: Claude <noreply@anthropic.com>
…default Claude-Session: https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibzpqH1nQTsbGckLspg Final green head for L1 · zone
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 REWORK at M1. The restore runs on every failure, including one where the promote may have landed, and the published text says that cannot happen.
On the honestWrites edit (your question). It keeps the case's strength, and adds a pin.
Nits (not blocking).
After the fix: a new green head and the same pins re-read (the mutations file, the honestWrites file, the ablation). No L2 is owed (Clause-② no, Metadata-protocol none). |
… wrote nothing A 4xx refusal, or a failure before the write is sent, leaves nothing written, so the demotions are put back. A failure with no answer or a 5xx may have landed, so nothing is undone and the re-read shows the result. Claude-Session: https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibzpqH1nQTsbGckLspg Final green head for L1 delta · zone
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 ACCEPT at Face. M1 is closed. I read the delta from
Nits (not blocking).
|
Claude-Session: https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibzpqH1nQTsbGckLspg Landing · zone
|
Fixes #34860
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
AppManagementPageset-default handler. The order stays demote-first, promote-second. The handler now records each outgoing default whose demotion the server accepted. When a later write fails and that failure is known to have written nothing, it saves each of those apps back withisDefault: truethrough the samesaveApphelper, so in the same package scope the demotion used, and then shows the original failure. A failure counts as having written nothing when the server answered it with a 4xx refusal (the client puts the status onhttpStatus; a target in a read-only package answers 403 "Cannot overlay 'app' in package …: that package is read-only"), or whensaveAppfailed before its write was sent (the stored-app read failed or found nothing;saveAppmarks those throws). In those cases the failed write changed nothing, so the restore cannot make two defaults. Any other failure (no answer, such as a dropped connection or a timeout, or a 5xx) may have been written, so the promote may have landed and a restore could leave two defaults. For those, the handler sends no restore write and keeps the earlier behaviour: the failure toast, then the re-read, which shows the result. A refused demotion leaves nothing to restore and sends no further write.appManagement.toast.restoreDefaultFailedin all eleven console locales (@object-ui/i18n), as a keyed template with a{{reason}}hole like the page's other failure toasts._packageIdonly, and the page reads no package writability. The card's other branch (refuse a locked target before any write) would need a new read, and the dispatch ruled out a new server call, so this PR only adds the restore.handleSetDefaultView). Its PR left one case open: the clear lands, the set is refused, and the object has no default view. This PR closes that case for apps, when the refusal is a 4xx.@object-ui/i18nin the changeset, and the honestWrites case. The pre-write refusal branch is left out..changeset/34860-app-set-default-restore.md:@object-ui/consoleand@object-ui/i18npatch, with both declaration lines.Tests
New top-level describe in the existing harness
AppManagementPage.mutations.test.tsx(the shared-harness rule, ruling record 6583487846). The outgoing default is in a writable package and the target is in a read-only one. The refusals have the shape the client throws (anErrorwithhttpStatus). Each case asserts every write with the package scope it named, and, where it applies, the default set that the writes which landed leave behind:TypeError('Failed to fetch'), nohttpStatus) and promote failed with a 5xx (504): exactly the two writes, no restore write, and one error toast;AppManagementPage.honestWrites-12300.test.tsxhad a case that pinned the defect ("a demotion that landed is shown": no app is the default after a refused promote). Its refusal now carrieshttpStatus: 403, and it asserts the restore: three writes, and the previous default's row still shows Default.Readings
pnpm --dir ui exec vitest run --maxWorkers=2 apps/console/src/pages/system/__tests__/(under the verify lock) at b4f04ad: Test Files 12 passed (12), Tests 111 passed (111),VERDICT command-exit 0.scripts/ablation-replace.mjs(each restored to blob == HEAD withgit diff HEADempty), over the mutations and honestWrites files:wroteNothing(e) ? demoted : []→demoted): 2 failed | 32 passed. The two new no-answer and 5xx cases failed; the 403 restore cases, the demotion-refused case and CONTROL stayed green.for (const prev of toRestore) {→for (const prev of ([] as any[])) {): 3 failed | 31 passed (promote-refused, restore-refused, honestWrites restore).pnpm --filter @object-ui/console run type-checkat b4f04ad: exit 0 (the console tsconfig includessrc, so the test files are compiled).@object-ui/i18ntype-check exit 0 at e99dac83 (its files are unchanged since then).ui:check:i18n-keys,check:i18n-drift,check:i18n-dead-keys,check:new-line-citationsexit 0 (the last: 0 new citations).dispatch-gates.mjs --commandsat b4f04ad: 41 derived gates (the same list as at e99dac83), all 41 exited 0, includingcheck:type-check-debtandpnpm --dir ui exec vitest run scripts/.--ran: 41 accounted, 0 NOT-MEASURED.overlap-check.mjsat b4f04ad: merges cleanly with origin/main cb3f8b9 and with the one open PR that shares a file (VERDICT clean exit 0).Acceptance notes
Verification
Read first: the
handleSetDefaultcatch block inui/apps/console/src/pages/system/AppManagementPage.tsx(the restore loop), then the new describe inAppManagementPage.mutations.test.tsx.Two-minute check:
pnpm --dir ui exec vitest run apps/console/src/pages/system/__tests__/AppManagementPage.mutations.test.tsx. Expected result: all pass, including the cases under "a refused promote restores the previous default".Generated by Claude Code